<page-header></page-header>
<div nz-row>
  <div nz-col nzSpan="24">
    <nz-card style="width:100%;">
      <div class="ant-advanced-search-form">
        <div nz-row [nzGutter]="24">

          <div nz-col [nzSpan]="8">
            <nz-form-item>
              <nz-form-label>岗位名称</nz-form-label>
              <nz-form-control>
                <input nz-input [(ngModel)]="positionsQueryParam.name" placeholder="岗位名称"
                       name="positionsQueryParam_name"/>
              </nz-form-control>
            </nz-form-item>
          </div>

          <div nz-col [nzSpan]="8">
            <nz-form-item>
              <nz-form-label>岗位编号</nz-form-label>
              <nz-form-control>
                <input nz-input [(ngModel)]="positionsQueryParam.no" placeholder="岗位编号" name="positionsQueryParam_no"/>
              </nz-form-control>
            </nz-form-item>
          </div>

        </div>
        <div nz-row style="margin-bottom: 4px;">
          <div nz-col [nzSpan]="18" style="text-align: left">
            <button nz-button [nzType]="'primary'" (click)="positionsSaveShowModal()" >新增</button>
            <button nz-button nzDanger [nzType]="'dashed'" [disabled]="selectPositionsInfo == null"
                    nz-popconfirm
                    nzPopconfirmTitle="确定要删除岗位吗?"
                    nzPopconfirmPlacement="top"
                    (nzOnConfirm)="confirmPositionsDel()" >删除</button>
          </div>

          <div nz-col [nzSpan]="6" style="text-align: right">
            <button nz-button [nzType]="'primary'" (click)="searchPositionsList()">查询</button>
            <button nz-button (click)="resetQuery()">重置</button>
          </div>
        </div>
      </div>
      <div class="search-result-list">
        <ng-template #totalTemplate let-total> 共{{ positionsInfoTotal }}条</ng-template>
        <nz-table #positionsInfoTable
                  nzShowPagination
                  nzShowSizeChanger
                  [nzFrontPagination]='false'
                  [nzShowTotal]="totalTemplate"
                  [nzData]='positionsInfoList'
                  [nzTotal]='positionsInfoTotal'
                  [(nzPageIndex)]='positionsInfoPageNum'
                  [(nzPageSize)]='positionsInfoPageSize'
                  (nzPageIndexChange)='positionsInfoListPageIndexChange($event)'
                  (nzPageSizeChange)='positionsInfoListPageSizeChange($event)'>
          <thead>
          <tr>
            <th>选中</th>
            <th>岗位名称</th>
            <th>岗位编码</th>
            <th>备注</th>
            <th>创建时间</th>
          </tr>
          </thead>
          <tbody>
          <tr (click)='onSelectPositionsInfoRow(data.id,!data.selected)' *ngFor='let data of positionsInfoTable.data'>
            <td nzLeft [nzShowCheckbox]='true' [(nzChecked)]='data.selected'
                (nzCheckedChange)='onSelectPositionsInfoRow(data.id,$event)'></td>
            <td>{{ data.name }}</td>
            <td>{{ data.no }}</td>
            <td>{{ data.notes }}</td>
            <td>{{ data.createTime | date:'yyyy-MM-dd HH:mm'}}</td>
          </tr>
          </tbody>
        </nz-table>
      </div>
    </nz-card>
  </div>
</div>

<!-- 新增岗位 -->
<nz-modal
  [(nzVisible)]="positionsSaveModalShowFlag"
  nzTitle="新增岗位"
  [nzContent]="positionsSaveContent"
  [nzFooter]="positionsSaveFooter"
  (nzOnCancel)="positionsSaveHandleCancel()">

  <ng-template #positionsSaveContent>
    <form nz-form *ngIf="positionsSaveParam!=null">


      <nz-form-item>
        <nz-form-label [nzSpan]="7">岗位名称</nz-form-label>
        <nz-form-control [nzSpan]="12">
          <input nz-input [(ngModel)]="positionsSaveParam.name" name="positionsSaveParam_name" placeholder="输入岗位名称"/>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSpan]="7">岗位编号</nz-form-label>
        <nz-form-control [nzSpan]="12">
          <input nz-input [(ngModel)]="positionsSaveParam.no" name="positionsSaveParam_no" placeholder="输入岗位编号"/>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSpan]="7">备注</nz-form-label>
        <nz-form-control [nzSpan]="12">
          <input nz-input [(ngModel)]="positionsSaveParam.notes" name="positionsSaveParam_notes" placeholder="备注"/>
        </nz-form-control>
      </nz-form-item>

    </form>
  </ng-template>

  <ng-template #positionsSaveFooter>
    <button nz-button nzType="default" (click)="positionsSaveHandleCancel()">取消</button>
    <button nz-button nzType="primary" (click)="positionsSaveHandleSave()" [nzLoading]="positionsSaveLoading">保存</button>
  </ng-template>
</nz-modal>
